package com.singleton;

/**
 * 同步单例
 * synchronized关键字修饰，线程安全。在整个线程中不会被其他现场所改变
 * Created by wangg on 2017/12/10.
 */
public class SynSingleton {
    private static SynSingleton synSingleton=null;

    public static synchronized SynSingleton getSingleton(){
        if(synSingleton==null){
            return new SynSingleton();
        }
        return synSingleton;
    }
}
